﻿using System;
using System.IO;
using System.Windows.Forms;
using DevelopTool.Common;
using DevelopTool.Forms.BaseForms;

namespace DevelopTool.Forms.ToolForms
{
    public partial class MarkdownEditorForm2 : BaseUIPage
    {
        private string filePath;

        /// <summary>
        /// 文件路径
        /// </summary>
        public string FilePath
        {
            get
            {
                return this.filePath;
            }
            set
            {
                this.filePath = value;
            }
        }

        public MarkdownEditorForm2()
        {
            InitializeComponent();
        }

        private void MarkdownEditorForm2_Load(object sender,EventArgs e)
        {
            if(!string.IsNullOrEmpty(this.filePath) && File.Exists(this.filePath))
            {
                this.markdownEditorControl2.FileContent = this.filePath;
            }
        }

        private void markdownEditorControl21_OnNeedChangeControlTitle(string title)
        {
            TabPage parentTabPage = this.GetParentControl<TabPage>();
            if(parentTabPage != null)
            {
                parentTabPage.Text = title;//设置TabPage的标签文本
            }
        }
    }
}
